<?php defined('SYSPATH') or die('No direct script access.');

class Controller_Show extends Controller_Template {

    public function before()
    {
        parent::before();
        
        if ($this->auto_render === TRUE)
        {
            $this->template->content_right(hook('sidebar'));
        }
    }

    public function after()
    {
        if ($this->auto_render === TRUE)
        {
        	;
        }
        
        parent::after();
    }
    
	public function action_index()
	{
		;
	}
	
	public function action_about(){
		$this->title = '关于我';
		$this->request->controller('about');
		
		$this->content = View::factory('smarty/about');
	}
	
	public function action_category(){
		if ($category = $this->request->param('id')){
			$this->title = $category.'月文章';
			
			$list = MON::factory('article')->find(array('addTime'=>array('$gte'=>strtotime($category),'$lt'=>strtotime($category.' +1 month'))));
		
			$this->pagination = new Pagination(array(
				'total_items'=>$list->count()
			));
			
			$list
			->skip($this->pagination->offset)
			->limit($this->pagination->items_per_page)
			->sort(array('addTime'=>-1));
			
			$this->content = View::factory('index/default')
			->set('list',$list);
		}else
			lib_url::redirect('tag/top10');
	}
} // End Welcome
